<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>复合事件（toggle）</title>
    //此功能在1.9版本之后就去掉了
    <script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("body").toggle(
                function () {
                    $(this).css("background-color","red");
                },
                function () {
                    $(this).css("background-color","yellow");
                },
                function () {
                    $(this).css("background-color","blue");
                }
            );
        })
    </script>
</head>
<body>
<div style="border: 3px solid red;" id="textId">
    hello text
</div>
</body>
</html>